<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>修改密码</title>
	<script type="text/javascript" src = "js/jquery.js"></script>
	<style type="text/css">
		span{
			color:red;
		}
	</style>
  </head>
  
  <body>
  <h3>修改密码</h3>
  <%
  	String code = request.getParameter("p");
  	if("wrong".equals(code)){
   %>
   <div style="color:red;">旧密码输入错误</div>
   <%}else if("re".equals(code)){%>
   <div style="color:red;">密码相同，没有作何更改，请重新输入新密码</div>
   <%}else if("fail".equals(code)){%>
   <div style="color:red;">操作失败</div>
   <%} %>
  <form action="account.jspx?p=edit" method = "post" id = "myform">
  		旧密码：<input type = "text" name = "oldP" id = "opwd"/><span id = "opwd_error"></span><br/>
  		新密码：<input type = "text" name = "newP" id = "npwd"/><span id = "npwd_error"></span><br/>
  		<input type = "button" value = "提交" id = "btn"/>
  </form>
  
  <script type="text/javascript">
  	$(document).ready(function(){
	  	
	  	 $("#opwd").keydown(function(){
	  		$("#opwd_error").html("");
	  	});
	  	 $("#npwd").keydown(function(){
	  		$("#npwd_error").html("");
	  	});
  		$("#btn").click(function(){
  			
  			var opwd=$("#opwd").val();
  			var npwd = $("#npwd").val();
  			
  			if(opwd==null || opwd==""){
  				$("#opwd").focus();
  				$("#opwd_error").html("密码不可为空：");
  				return ;
  			}
  			if(npwd==null || npwd==""){
  				$("#npwd").focus();
  				$("#npwd_error").html("密码不可为空：");
  				return ;
  			}
  			
  			$("#myform").submit();
  		});
  	});
  </script>
  </body>
</html>
